
declare @uName nvarchar(50);
SELECT @uName=SYSTEM_USER;

EXEC sp_attach_db @dbname = 'P2Cuberry', 
     @filename1 = 'C:\Cuberry\CuberryDB\P2Cuberry.mdf',	-- make sure you have copied the files in the correct folder 
     @filename2 = 'C:\Cuberry\CuberryDB\P2Cuberry.ldf'	


-- copies your current user to the database, so you get admin permissions
INSERT INTO [P2Cuberry].[dbo].[XSecUser]
			([UserID], [UserGroupID], [Active])
VALUES		(@uName, 1, 1)
